<?php

namespace App\Http\Controllers\Home;

use App\Http\Controllers\Controller;
use App\Model\ConfigModel;
use Illuminate\Http\Request;

class TechCenterController extends Controller
{
    //
    /**
     * 列表
     *
     * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function techCenter()
    {
        $data['list'] = \DB::table('tech_center')
            ->select(['id','img','title'])
            ->get();
        $data['seo'] = ConfigModel::where('config_type','tech_center')
            ->first();
        return view('front.tech_center')->with('data',$data);
    }

    /**
     * 详情
     *
     * @param $id
     * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
     */
    public function techCenterDetail($id)
    {
        $data['info'] = \DB::table('tech_center')->find($id);
        if (empty($data['info'])){
            return redirect('404');
        }
        $data['list'] = \DB::table('tech_center')
            ->select(['id','img','title'])
            ->get();
        return view('front.tech_center_detail')->with('data',$data);
    }
}
